package com.clkj.aimin.dao.doctor;

import com.clkj.aimin.pojo.doctor.Doctor;
import com.clkj.aimin.pojo.user.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * @author yawang
 * @create 2024/04/02 16:49:26
 **/
@Repository
public interface DoctorMapper extends Mapper<Doctor> {

//    @Select("select a.*,b.department_name from t_cl_doctor a left join t_cl_department b on a.department_id = b.department_id where a.doctor_status = 1 ")
    @Select("select a.*,b.doctor_name  from t_cl_user  a left join t_cl_doctor  b on b.inuserId = a.user_id  where a.user_type =1 ")
    List<User> listDoctors();

    @Insert("insert into t_cl_doctor (doctor_name,inuserId) values (#{doctorName},#{inuserId})")
    @Options(useGeneratedKeys = true, keyProperty = "doctorId", keyColumn = "doctor_id")
    void addDoctor(Doctor doctor);
}
